package kr.ac.hanyang.gsen.tbook.dao.entity;


public class Book extends Entity {

	private String isbn = "";
	private String title = "";
	private String rank = "";
	private String author = "";
	private String publisher = "";
	private String pages = "";
	private String imageUrl = "";
	private String publishDate = "";
	private String updateDate = "";
	private String registDate = "";
	
	private String description = "";
	private String memo = "";
	private String isReading = "";
	private String myPoint = "";
	private String price = "";
	private String mobileUrl = "";
	
	public Book() {
		// TODO Auto-generated constructor stub
	}

	public Book(String isbn, String title)
	{
		this.isbn = isbn;
		this.title = title;
	}
	

	public String getIsbn() {
		return isbn;
	}


	public void setIsbn(String isbn) {
		this.isbn = isbn;
	}


	public String getTitle() {
		return title;
	}
	
	
	public void setTitle(String title) {
		this.title = title;
	}


	public String getRank() {
		return rank;
	}
	
	public void setRank(String rank)
	{
		this.rank = rank;
	}
	
	
	public String getAuthor() {
		return author;
	}


	public void setAuthor(String author) {
		this.author = author;
	}


	public String getPublisher() {		
		String result = "";
		
		if (publisher != null)
			result = publisher;
		
		return result;
	}


	public void setPublisher(String publisher) {
		this.publisher = publisher;
	}


	public String getPages() {
		String result = "";
		
		if (pages != null)
			result = pages;
		
		return result;
	}


	public void setPages(String pages) {
		this.pages = pages;
	}

	
	public String getImageUrl() {
		String result = "";
		
		if (imageUrl != null)
			result = imageUrl;
		
		return result;
	}


	public void setImageUrl(String imageUrl) {
		this.imageUrl = imageUrl;
	}
	

	public String getPublishDate() {		
		String result = "";
		
		if (publishDate != null)
			result = publishDate;
		
		return result;
	}


	public void setPublishDate(String publishDate) {
		String formatDate = "";
		if (isReading != null && publishDate.length() > 0 && publishDate.contains("-") == false)
			formatDate = publishDate.substring(0, 4) + "-" + publishDate.substring(4, 6) + "-" + publishDate.substring(6);
		else
			formatDate = publishDate;
		
		this.publishDate = formatDate;
	}


	public String getUpdateDate() {
		return updateDate;
	}


	public void setUpdateDate(String updateDate) {
		this.updateDate = updateDate;
	}

	public String getRegistDate() {
		return registDate;
	}


	public void setRegistDate(String registDate) {
		this.registDate = registDate;
	}
	
	public String getDescription() {
		return description;
	}
	
	public void setDescription(String description) {
		this.description = description;
	}
	
	public String getMemo() {
		return memo;
	}
	
	public void setMemo(String memo) {
		this.memo = memo;
	}

	public Boolean getIsReading() {
		Boolean result = false;
		
		if (isReading != null && isReading.length() > 0 && isReading.equals("true"))
		{
			result = true;
		}
		
		return result;
	}
	
	public void setIsReading(String isReading) {
		this.isReading = isReading;
	}
	
	public String getMyPoint() {
		String result = "";
		
		if (myPoint != null)
			result = myPoint;
		
		return result;
	}
	
	public void setMyPoint(String myPoint) {
		this.myPoint = myPoint;
	}
	
	public String getPrice() {
		String result = "";
		
		if (price != null)
			result = price;
		
		return result;
	}
	
	public void setPrice(String price) {
		this.price = price;
	}
	
	public String getMobileUrl() {
		String result = "";
		
		if (mobileUrl != null)
			result = mobileUrl;
		
		return result;
	}
	
	public void setMobileUrl(String mobileUrl) {
		this.mobileUrl = mobileUrl;
	}
	
	@Override
	public String toString() {
		
		String result = "";
		result += "isbn : " + isbn;
		result += "\r\ntitle : " + title;
		result += "\r\nauthor : " + author;
		result += "\r\npublisher : " + publisher;
		result += "\r\npages : " + pages;
		result += "\r\npublishDate : " + publishDate;
		
		return "";
	}
	
	//public void purge
}
